<%--
  Created by IntelliJ IDEA.
  food: 61003
  Date: 2023/3/2
  Time: 16:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>用户更新</title>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/bootstrap-theme.min.css">
    <script src="/js/jquery-1.12.4.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <style>
        body{
            background-color: #9acfea;
        }
        *{
            font-family: "楷体";
            font-size: 2.0rem;
        }
        input{
            width: 300px;
        }
        .table1{
            text-align:center;
            border:1px solid;
            height:550px;
            width:540px;
            background-color: skyblue;
        }
        #biao{
            background-color: aliceblue;
            text-align:center;
            border:1px solid;
            height:500px;
            width:500px;
        }
    </style>
</head>
<body>

<form action="/food" method="post">
    <table  align="center" class="table1">

        <tr>
            <td align="center">
                <table  align="center" id="biao">
                    <caption>${requestScope.food.food_name} 正在${requestScope.food.food_id eq null?"新增": "更新"}</caption>
                    <tr>
                        <td>
                            <input type="hidden" name="food_id"value="${food.food_id}">
                        </td>
                        <td>
                            <c:if test="${requestScope.food.food_id != null}">
                                <div  class="form-group">
                                    <label>用户ID</label>
                                    <span>${food.food_id}</span>
                                </div>
                            </c:if>
                        </td>
                    </tr>
                    <tr>
                        <td align="right"><label>食物名:</label></td>
                        <td><input name="food_name"value="${food.food_name}"></td>
                    </tr>

                    <tr>
                        <td align="right"><label>type_id:</label></td>
                        <td>
                            <input name="type_id" value="${food.type_id}" placeholder="请输入1/4/5/6/7">
                        </td>
                    </tr>

                    <tr>
                        <td align="right"><label>food_price:</label></td>
                        <td><input name="food_price" value="${food.food_price}"></td>
                    </tr>

                    <tr>
                        <td align="right"><label>food_mprice:</label></td>
                        <td><input name="food_mprice" value="${food.food_mprice}"></td>
                    </tr>

                    <tr>
                        <form action="/upload" method="post" enctype="multipart/form-data">
                            <label>文件说明</label>
                            <input name="note"> <br>
                            <hr>
                            <input type="file" name="file1" accept="image/*">
                            <hr>
                            <button>开始上传</button>
                        </form>
                    </tr>

                    <tr>
                        <td align="right"><label>food_desc:</label></td>
                        <td><input name="food_desc" value="${food.food_desc}"></td>
                    </tr>
                    <tr align="center">
                        <td colspan="2"><button>提交</button></td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr height=40px></tr>
    </table>

</form>
<c:if test="${requestScope.error != null}">
    <div style="color: red">${requestScope.error}</div>
</c:if>
<script>
    $("#sc").change(function (){
        let va=$('#sc option:selected').val();
        $("#type_id").val(va);
    })
</script>
</body>
</html>

